package org.wu.framework.authorization.platform.controller;


import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.wu.framework.authorization.platform.config.TitleProperties;
import org.wu.framework.authorization.platform.domain.model.lazy.title.TitleInfo;
import org.wu.framework.web.response.Result;
import org.wu.framework.web.response.ResultFactory;
import org.wu.framework.web.spring.EasyController;

@Slf4j
@Tag(name = "Title信息维护者")
@EasyController("/v1/api/title")
public class TitleProvider {

    @Resource
    private TitleProperties titleProperties;

    /**
     * 获取标题信息
     * @return
     */
    @GetMapping("/info")
    public Result<TitleInfo> info() {
        TitleInfo titleInfo = new TitleInfo();
        titleInfo.setName(this.titleProperties.getName());
        titleInfo.setWechatKeyWord(this.titleProperties.getWechatKeyWord());
        titleInfo.setWechatVerificationCode(this.titleProperties.getWechatVerificationCode());
        titleInfo.setEnabled(this.titleProperties.getEnabled());
        return ResultFactory.successOf(titleInfo);
    }

}
